package com.cadre.web.controller.officer;

import com.cadre.common.utils.R;
import com.cadre.common.utils.annotation.SysLog;
import com.cadre.common.utils.common.GenerateUUID;
import com.cadre.common.utils.oldutil.DateUtil;
import com.cadre.common.utils.oldutil.ValidatorUtils;
import com.cadre.system.domain.officer.A25;
import com.cadre.system.service.AssessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

@Api(value = "考察评价", tags = {"考察评价"})
@RequestMapping({"/a01/a25"})
@RestController
/* loaded from: A25Controller.class */
public class A25Controller {
    @Autowired
    private AssessService assService;

    @GetMapping({"/list/{personid}"})
    @ApiOperation("获取考察评价列表")
    public R list(@PathVariable String personid) {
        return R.ok().put("data", (Object) this.assService.selectListByPersonid(personid));
    }

    @GetMapping({"/info/{flowid}"})
    @ApiOperation("获取一条考察评价")
    public R info(@PathVariable("flowid") String flowid) {
        return R.ok().put("A25", (Object) ((A25) this.assService.getBaseMapper().selectById(flowid)));
    }

    @PostMapping({"/save"})
    @SysLog(value = "新增考察评价", target = "A01", set = "A25", type = 0)
    @ApiOperation("添加考察评价")
    public R save(@RequestBody A25 a25) {
        a25.setFlowid(GenerateUUID.getUUID());
        this.assService.getBaseMapper().insert(a25);
        return R.ok();
    }

    @PostMapping({"/update"})
    @SysLog(value = "更新考察评价", target = "A01", set = "A25", type = 1)
    @ApiOperation("考察评价更新")
    public R update(@RequestBody A25 a25) {
        ValidatorUtils.validateEntity(a25, new Class[0]);
        this.assService.getBaseMapper().updateById(a25);
        return R.ok();
    }

    @PostMapping({"/delete"})
    @SysLog(value = "删除考察评价", target = "A01", set = "A25", type = DateUtil.SUB_MONTH)
    @ApiOperation("考察评价删除")
    public R delete(@RequestBody String[] flowids) {
        this.assService.getBaseMapper().deleteBatchIds(Arrays.asList(flowids));
        return R.ok();
    }
}
